home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume2 / nethack / part15 < prev    next >
Encoding:
Internet Message Format  |  1987-07-29  |  56.1 KB

  1. Path: uunet!seismo!columbia!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!tektronix!tekgen!tekred!games-request
  2. From: games-request@tekred.TEK.COM
  3. Newsgroups: comp.sources.games
  4. Subject: v02i015:  nethack - display oriented dungeons & dragons, Part15/16
  5. Message-ID: <1457@tekred.TEK.COM>
  6. Date: 28 Jul 87 18:54:42 GMT
  7. Sender: billr@tekred.TEK.COM
  8. Lines: 2214
  9. Approved: billr@tekred.TEK.COM
  10.  
  11. Submitted by: mike@genat.UUCP (Mike Stephenson)
  12. Comp.sources.games: Volume 2, Issue 15
  13. Archive-name: nethack/Part15
  14.  
  15.  
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 15 (of 16)."
  24. # Contents:  Makefile.pc bones.c dog.c mkobj.c monst.c pctty.c pray.c
  25. #   rumors.kaa search.c sit.c topl.c write.c you.h
  26. # Wrapped by billr@tekred on Tue Jul 28 09:49:49 1987
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f Makefile.pc -a "${1}" != "-c" ; then 
  29.   echo shar: Will not over-write existing file \"Makefile.pc\"
  30. else
  31. echo shar: Extracting \"Makefile.pc\" \(3966 characters\)
  32. sed "s/^X//" >Makefile.pc <<'END_OF_Makefile.pc'
  33. X#
  34. X#    SCCS Id: @(#)Makefile.pc    1.3    87/07/14
  35. X#     Makefile for NetHack (PC) version 1.0 written using
  36. X#    Microsoft(tm) "C" v3.0 or better.
  37. X# 
  38. X# Large memory model, register bug, remove stack probes:
  39. XWIZARD=
  40. XV = 35
  41. XCFLAGS = -AL -DREGBUG -DLINT_ARGS -DVER=$V $(WIZARD) -Ot -Gs
  42. X
  43. X# The game name
  44. XGAME = hack.exe
  45. X
  46. X# The game directory
  47. XGAMEDIR = \h
  48. X
  49. X# All object modules
  50. XOBJS = decl.obj apply.obj bones.obj cmd.obj do.obj \
  51. X    do_name.obj do_wear.obj dog.obj dogmove.obj eat.obj end.obj \
  52. X    engrave.obj fight.obj fountain.obj hack.obj invent.obj \
  53. X    lev.obj main.obj makemon.obj mhitu.obj mklev.obj \
  54. X    mkmaze.obj mkobj.obj mkshop.obj mon.obj monmove.obj\
  55. X    monst.obj o_init.obj objnam.obj options.obj \
  56. X    pager.obj polyself.obj potion.obj pray.obj pri.obj prisym.obj\
  57. X    read.obj rip.obj rumors.obj save.obj \
  58. X    search.obj shk.obj shknam.obj sit.obj spell.obj steal.obj \
  59. X    termcap.obj timeout.obj topl.obj topten.obj track.obj trap.obj \
  60. X    tty.obj unix.obj u_init.obj vault.obj wield.obj \
  61. X    wizard.obj worm.obj worn.obj write.obj zap.obj \
  62. X    version.obj rnd.obj alloc.obj msdos.obj
  63. X
  64. X# The main target
  65. X#
  66. X$(GAME) : $(OBJS)
  67. X    link $(OBJS), $(GAME) /NOIG /STACK:4000 /CP:1;
  68. X
  69. X#    variable auxilary files.
  70. X#
  71. XVARAUX = data rumors
  72. X
  73. Xinstall : $(GAME) $(VARAUX)
  74. X    - exepack $(GAME) $(GAMEDIR)\$(GAME)
  75. X    - exemod $(GAMEDIR)\$(GAME) /max 1
  76. X
  77. Xclean :
  78. X    erase $(GAME)
  79. X
  80. Xspotless: clean
  81. X    erase *.obj
  82. X    erase main.c
  83. X    erase tty.c
  84. X    erase unix.c
  85. X
  86. Xsrcs :
  87. X    copy makefile \tmp
  88. X    copy *.c \tmp
  89. X    copy *.h \tmp
  90. X    copy \local\make\make.doc \tmp
  91. X    copy \local\make\make.ini \tmp
  92. X    copy \bin\make.exe \tmp
  93. X    cd \tmp
  94. X    time
  95. X    touch *.*
  96. X    arc m hack$Vs * *.*
  97. X    cd $(CWD)
  98. X
  99. X
  100. X#    Other dependencies
  101. X#
  102. XRUMORFILES= rumors.base rumors.kaa rumors.mrx
  103. X
  104. Xrumors :  config.h $(RUMORFILES) makedefs
  105. X    ./makedefs -r
  106. X
  107. Xdata :  config.h data.base makedefs
  108. X    ./makedefs -d
  109. X
  110. Xonames.h :  config.h objects.h makedefs
  111. X    ./makedefs -o
  112. X
  113. X#    Below is a kluge.  date.h should actually depend on any source
  114. X#    module being changed. (but hack.h is close enough for most).
  115. X#
  116. Xdate.h :  hack.h makedefs
  117. X    ./makedefs -D
  118. X
  119. Xtrap.h :  config.h makedefs
  120. X    ./makedefs -t
  121. X
  122. Xmain.obj :
  123. X
  124. Xmain.c :  pcmain.c hack.h
  125. X    copy pcmain.c main.c
  126. X
  127. Xtty.obj :
  128. X
  129. Xtty.c :  pctty.c hack.h msdos.h
  130. X    copy pctty.c tty.c
  131. X
  132. Xunix.obj :
  133. X
  134. Xunix.c :  pcunix.c hack.h mkroom.h
  135. X    copy pcunix.c unix.c
  136. X
  137. Xdecl.obj :  hack.h mkroom.h
  138. Xapply.obj :  hack.h edog.h mkroom.h
  139. Xbones.obj :  hack.h
  140. Xhack.obj :  hack.h
  141. Xcmd.obj :  hack.h func_tab.h msdos.h
  142. Xdo.obj :  hack.h
  143. Xdo_name.obj :  hack.h
  144. Xdo_wear.obj :  hack.h
  145. Xdog.obj :  hack.h edog.h mkroom.h
  146. Xdogmove.obj :  hack.h mfndpos.h
  147. Xeat.obj :  hack.h
  148. Xend.obj :  hack.h
  149. Xengrave.obj :  hack.h
  150. Xfight.obj :  hack.h
  151. Xfountain.obj :  hack.h
  152. Xinvent.obj :  hack.h wseg.h
  153. Xioctl.obj :  config.h
  154. Xlev.obj :  hack.h mkroom.h wseg.h
  155. Xmakemon.obj :  hack.h
  156. Xmhitu.obj :  hack.h
  157. Xmklev.obj :  hack.h mkroom.h
  158. Xmkmaze.obj :  hack.h mkroom.h
  159. Xmkobj.obj :  hack.h
  160. Xmkshop.obj :  hack.h mkroom.h eshk.h
  161. Xmon.obj :  hack.h mfndpos.h
  162. Xmonmove.obj :  hack.h mfndpos.h
  163. Xmonst.obj :  hack.h eshk.h
  164. Xo_init.obj :  config.h objects.h onames.h
  165. Xobjnam.obj :  hack.h
  166. Xoptions.obj :  config.h hack.h
  167. Xpager.obj :  hack.h
  168. Xpolyself.obj :  hack.h
  169. Xpotion.obj :  hack.h
  170. Xpray.obj :  hack.h
  171. Xpri.obj :  hack.h
  172. Xprisym.obj :  hack.h wseg.h
  173. Xread.obj :  hack.h
  174. Xrip.obj :  hack.h
  175. Xrumors.obj :  config.h
  176. Xsave.obj :  hack.h
  177. Xsearch.obj :  hack.h
  178. Xshk.obj :  hack.h mfndpos.h mkroom.h eshk.h
  179. Xshknam.obj :  hack.h
  180. Xsit.obj :  hack.h
  181. Xspell.obj:  hack.h
  182. Xsteal.obj :  hack.h
  183. Xtermcap.obj :  config.h flag.h
  184. Xtimeout.obj :  hack.h
  185. Xtopl.obj :  hack.h
  186. Xtopten.obj :  hack.h
  187. Xtrack.obj :  hack.h
  188. Xtrap.obj :  hack.h mkroom.h
  189. Xu_init.obj :  hack.h
  190. Xvault.obj :  hack.h mkroom.h
  191. Xversion.obj : hack.h date.h
  192. Xwield.obj :  hack.h
  193. Xwizard.obj :  hack.h
  194. Xworm.obj :  hack.h wseg.h
  195. Xworn.obj :  hack.h
  196. Xwrite.obj :  hack.h
  197. Xzap.obj :  hack.h
  198. Xmsdos.obj : msdos.h
  199. Xextern.h: config.h
  200. X    touch extern.h
  201. Xhack.h :  config.h objclass.h monst.h gold.h trap.h obj.h flag.h rm.h permonst.h onames.h spell.h extern.h you.h
  202. X    touch hack.h
  203. Xobjects.h :  config.h objclass.h
  204. X    touch objects.h
  205. END_OF_Makefile.pc
  206. if test 3966 -ne `wc -c <Makefile.pc`; then
  207.     echo shar: \"Makefile.pc\" unpacked with wrong size!
  208. fi
  209. # end of overwriting check
  210. fi
  211. if test -f bones.c -a "${1}" != "-c" ; then 
  212.   echo shar: Will not over-write existing file \"bones.c\"
  213. else
  214. echo shar: Extracting \"bones.c\" \(3830 characters\)
  215. sed "s/^X//" >bones.c <<'END_OF_bones.c'
  216. X/*    SCCS Id: @(#)bones.c    1.3    87/07/14
  217. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  218. X/* bones.c - version 1.0.3 */
  219. X
  220. X#include "hack.h"
  221. Xextern char plname[PL_NSIZ];
  222. Xextern long somegold();
  223. Xextern struct monst *makemon();
  224. Xextern struct permonst pm_ghost;
  225. X
  226. X#ifdef DGK
  227. Xchar bones[FILENAME];
  228. X#else
  229. Xchar bones[] = "bones_xx";
  230. X#endif
  231. X
  232. X/* save bones and possessions of a deceased adventurer */
  233. Xsavebones(){
  234. Xregister fd;
  235. Xregister struct obj *otmp;
  236. Xregister struct trap *ttmp;
  237. Xregister struct monst *mtmp;
  238. X    if(dlevel <= 0 || dlevel > MAXLEVEL) return;
  239. X    if(!rn2(1 + dlevel/2)    /* not so many ghosts on low levels */
  240. X#ifdef WIZARD
  241. X        && !wizard
  242. X#endif
  243. X        ) return;
  244. X#ifdef DGK
  245. X    name_file(bones, dlevel);
  246. X#else
  247. X    bones[6] = '0' + (dlevel/10);
  248. X    bones[7] = '0' + (dlevel%10);
  249. X#endif
  250. X    if((fd = open(bones,0)) >= 0){
  251. X        (void) close(fd);
  252. X#ifdef WIZARD
  253. X        if(wizard)
  254. X            pline("Bones file already exists.");
  255. X#endif
  256. X        return;
  257. X    }
  258. X    /* drop everything; the corpse's possessions are usually cursed */
  259. X    otmp = invent;
  260. X    while(otmp){
  261. X        otmp->ox = u.ux;
  262. X        otmp->oy = u.uy;
  263. X        otmp->age = 0;        /* very long ago */
  264. X        otmp->owornmask = 0;
  265. X        if(rn2(5)) otmp->cursed = 1;
  266. X        if(!otmp->nobj){
  267. X            otmp->nobj = fobj;
  268. X            fobj = invent;
  269. X            invent = 0;    /* superfluous */
  270. X            break;
  271. X        }
  272. X        otmp = otmp->nobj;
  273. X    }
  274. X    /* spill any contained objects - added by GAN 03/23/87 */
  275. X    otmp = fcobj;
  276. X    while(otmp)  {
  277. X        register struct obj *otmp2;
  278. X
  279. X        otmp2 = otmp->nobj;
  280. X        spill_obj(otmp);
  281. X        otmp = otmp2;
  282. X    }
  283. X    if(!(mtmp = makemon(PM_GHOST, u.ux, u.uy))) return;
  284. X    mtmp->mx = u.ux;
  285. X    mtmp->my = u.uy;
  286. X    mtmp->msleep = 1;
  287. X    (void) strcpy((char *) mtmp->mextra, plname);
  288. X    mkgold(somegold() + d(dlevel,30), u.ux, u.uy);
  289. X    for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){
  290. X        mtmp->m_id = 0;
  291. X        if(mtmp->mtame) {
  292. X            mtmp->mtame = 0;
  293. X            mtmp->mpeaceful = 0;
  294. X        }
  295. X        mtmp->mlstmv = 0;
  296. X        if(mtmp->mdispl) unpmon(mtmp);
  297. X    }
  298. X    for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
  299. X        ttmp->tseen = 0;
  300. X    for(otmp = fobj; otmp; otmp = otmp->nobj) {
  301. X        otmp->o_id = 0;
  302. X         /* otmp->o_cnt_id = 0; - superfluous */
  303. X        otmp->onamelth = 0;
  304. X        otmp->known = 0;
  305. X        otmp->invlet = 0;
  306. X        if(otmp->olet == AMULET_SYM && !otmp->spe) {
  307. X            otmp->spe = -1;      /* no longer the actual amulet */
  308. X            otmp->cursed = 1;    /* flag as gotten from a ghost */
  309. X        }
  310. X    }
  311. X#ifdef DGK
  312. X    fd = open(bones, O_WRONLY | O_BINARY | O_CREAT, FMASK);
  313. X#else
  314. X    fd = creat(bones, FMASK);
  315. X#endif
  316. X    if(fd < 0) {
  317. X#ifdef WIZARD
  318. X        if(wizard)
  319. X            pline("Cannot create bones file - creat failed");
  320. X#endif
  321. X        return;
  322. X    }
  323. X#ifdef DGK
  324. X    savelev(fd,dlevel, COUNT | WRITE);
  325. X#else
  326. X    savelev(fd,dlevel);
  327. X#endif
  328. X    (void) close(fd);
  329. X}
  330. X
  331. X/*
  332. X * "spill" object out of box onto floor
  333. X */
  334. Xspill_obj(obj)
  335. Xstruct obj *obj;
  336. X{
  337. X    struct obj *otmp;
  338. X
  339. X    for(otmp = fobj; otmp; otmp = otmp->nobj)
  340. X        if(obj->o_cnt_id == otmp->o_id)  {
  341. X            obj->ox = otmp->ox;
  342. X            obj->oy = otmp->oy;
  343. X            obj->age = 0;
  344. X            if(rn2(5))
  345. X                obj->cursed = 1;
  346. X            obj->nobj = otmp->nobj;
  347. X            otmp->nobj = obj;
  348. X            return;
  349. X        }
  350. X}
  351. X        
  352. Xgetbones(){
  353. Xregister fd,x,y,ok;
  354. X    /* wizard check added by GAN 02/05/87 */
  355. X    if(rn2(3)    /* only once in three times do we find bones */
  356. X#ifdef WIZARD
  357. X        && !wizard
  358. X#endif
  359. X        ) return(0);
  360. X#ifdef DGK
  361. X    name_file(bones, dlevel);
  362. X#else
  363. X    bones[6] = '0' + dlevel/10;
  364. X    bones[7] = '0' + dlevel%10;
  365. X#endif
  366. X    if((fd = open(bones, 0)) < 0) return(0);
  367. X    if((ok = uptodate(fd)) != 0){
  368. X#ifdef WIZARD
  369. X        if(wizard)  {
  370. X            char buf[BUFSZ];
  371. X            pline("Get bones? ");
  372. X            getlin(buf);
  373. X            if(buf[0] == 'n')  {
  374. X                (void) close(fd);
  375. X                return(0);
  376. X            }
  377. X        }
  378. X#endif
  379. X        getlev(fd, 0, dlevel);
  380. X        for(x = 0; x < COLNO; x++) for(y = 0; y < ROWNO; y++)
  381. X            levl[x][y].seen = levl[x][y].new = 0;
  382. X    }
  383. X    (void) close(fd);
  384. X#ifdef WIZARD
  385. X    if(wizard)  {
  386. X        char buf[BUFSZ];
  387. X        pline("Unlink bones? ");
  388. X        getlin(buf);
  389. X        if(buf[0] == 'n')
  390. X            return(ok);
  391. X    }
  392. X#endif
  393. X    if(unlink(bones) < 0){
  394. X        pline("Cannot unlink %s .", bones);
  395. X        return(0);
  396. X    }
  397. X    return(ok);
  398. X}
  399. END_OF_bones.c
  400. if test 3830 -ne `wc -c <bones.c`; then
  401.     echo shar: \"bones.c\" unpacked with wrong size!
  402. fi
  403. # end of overwriting check
  404. fi
  405. if test -f dog.c -a "${1}" != "-c" ; then 
  406.   echo shar: Will not over-write existing file \"dog.c\"
  407. else
  408. echo shar: Extracting \"dog.c\" \(4228 characters\)
  409. sed "s/^X//" >dog.c <<'END_OF_dog.c'
  410. X/*    SCCS Id: @(#)dog.c    1.3    87/07/14
  411. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  412. X/* dog.c - version 1.0.3 */
  413. X
  414. X#include    "hack.h"
  415. Xextern struct monst *makemon();
  416. X#include "edog.h"
  417. X#include "mkroom.h"
  418. X
  419. Xstruct permonst li_dog =
  420. X    { "little dog", 'd',2,18,6,0,1,6,sizeof(struct edog) };
  421. Xstruct permonst dog =
  422. X    { "dog", 'd',4,16,5,0,1,6,sizeof(struct edog) };
  423. Xstruct permonst la_dog =
  424. X    { "large dog", 'd',6,15,4,0,2,4,sizeof(struct edog) };
  425. X
  426. Xstruct monst *
  427. Xmakedog(){
  428. Xregister struct monst *mtmp = makemon(&li_dog,u.ux,u.uy);
  429. X    if(!mtmp) return((struct monst *) 0); /* dogs were genocided */
  430. X    initedog(mtmp);
  431. X    return(mtmp);
  432. X}
  433. X
  434. Xinitedog(mtmp) register struct monst *mtmp; {
  435. X    mtmp->mtame = mtmp->mpeaceful = 1;
  436. X#ifdef WALKIES
  437. X    mtmp->mleashed = 0;
  438. X#endif
  439. X    EDOG(mtmp)->hungrytime = 1000 + moves;
  440. X    EDOG(mtmp)->eattime = 0;
  441. X    EDOG(mtmp)->droptime = 0;
  442. X    EDOG(mtmp)->dropdist = 10000;
  443. X    EDOG(mtmp)->apport = 10;
  444. X    EDOG(mtmp)->whistletime = 0;
  445. X}
  446. X
  447. X/* attach the monsters that went down (or up) together with @ */
  448. Xstruct monst *mydogs = 0;
  449. Xstruct monst *fallen_down = 0;    /* monsters that fell through a trapdoor */
  450. X    /* they will appear on the next level @ goes to, even if he goes up! */
  451. X
  452. Xlosedogs(){
  453. Xregister struct monst *mtmp;
  454. X    while(mtmp = mydogs){
  455. X        mydogs = mtmp->nmon;
  456. X        mtmp->nmon = fmon;
  457. X        fmon = mtmp;
  458. X        mnexto(mtmp);
  459. X    }
  460. X    while(mtmp = fallen_down){
  461. X        fallen_down = mtmp->nmon;
  462. X        mtmp->nmon = fmon;
  463. X#ifdef WALKIES
  464. X        mtmp->mleashed = 0;
  465. X#endif
  466. X        fmon = mtmp;
  467. X        rloc(mtmp);
  468. X    }
  469. X}
  470. X
  471. Xkeepdogs(){
  472. Xregister struct monst *mtmp;
  473. X    for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
  474. X        if(dist(mtmp->mx,mtmp->my) < 3 && follower(mtmp)
  475. X        && !mtmp->msleep && !mtmp->mfroz) {
  476. X#ifdef DGKMOD
  477. X        /* Bug "fix" for worm changing levels collapsing dungeon
  478. X         */
  479. X        if (mtmp->data->mlet == 'w') {
  480. X            if (canseemon(mtmp) || (Blind && Telepat))
  481. X                pline("The worm can't fit down the stairwell!");
  482. X#ifdef WALKIES
  483. X            pline("The leash slides off the slimy worm!");
  484. X            mtmp->mleashed = 0;
  485. X#endif
  486. X            continue;
  487. X        }
  488. X#endif
  489. X        relmon(mtmp);
  490. X        mtmp->nmon = mydogs;
  491. X        mydogs = mtmp;
  492. X        unpmon(mtmp);
  493. X        keepdogs();    /* we destroyed the link, so use recursion */
  494. X        return;        /* (admittedly somewhat primitive) */
  495. X    }
  496. X}
  497. X
  498. Xfall_down(mtmp) register struct monst *mtmp; {
  499. X    relmon(mtmp);
  500. X    mtmp->nmon = fallen_down;
  501. X    fallen_down = mtmp;
  502. X#ifdef WALKIES
  503. X    if (mtmp->mleashed)  {
  504. X
  505. X        pline("The leash comes off!");
  506. X        mtmp->mleashed = 0;
  507. X    }
  508. X#endif
  509. X    unpmon(mtmp);
  510. X    mtmp->mtame = 0;
  511. X}
  512. X
  513. X/* return quality of food; the lower the better */
  514. Xdogfood(obj) register struct obj *obj; {
  515. X    switch(obj->olet) {
  516. X    case FOOD_SYM:
  517. X        return(
  518. X        (obj->otyp == TRIPE_RATION) ? DOGFOOD :
  519. X        (obj->otyp < CARROT) ? ACCFOOD :
  520. X        (obj->otyp < CORPSE) ? MANFOOD :
  521. X        (poisonous(obj) || obj->age + 50 <= moves ||
  522. X            obj->otyp == DEAD_COCKATRICE)
  523. X            ? POISON : CADAVER
  524. X        );
  525. X    default:
  526. X        if(!obj->cursed) return(APPORT);
  527. X        /* fall into next case */
  528. X    case BALL_SYM:
  529. X    case CHAIN_SYM:
  530. X    case ROCK_SYM:
  531. X        return(UNDEF);
  532. X    }
  533. X}
  534. X
  535. X/* return roomnumber or -1 */
  536. Xinroom(x,y) xchar x,y; {
  537. X#ifndef QUEST
  538. X    register struct mkroom *croom = &rooms[0];
  539. X    while(croom->hx >= 0){
  540. X        if(croom->hx >= x-1 && croom->lx <= x+1 &&
  541. X           croom->hy >= y-1 && croom->ly <= y+1)
  542. X            return(croom - rooms);
  543. X        croom++;
  544. X    }
  545. X#endif
  546. X    return(-1);    /* not in room or on door */
  547. X}
  548. X
  549. Xtamedog(mtmp, obj)
  550. Xregister struct monst *mtmp;
  551. Xregister struct obj *obj;
  552. X{
  553. X    register struct monst *mtmp2;
  554. X
  555. X    /* worst case, at least he'll be peaceful. */
  556. X    mtmp->mpeaceful = 1;
  557. X    if(flags.moonphase == FULL_MOON && night() && rn2(6))
  558. X        return(0);
  559. X
  560. X    /* If we cannot tame him, at least he's no longer afraid. */
  561. X    mtmp->mflee = 0;
  562. X    mtmp->mfleetim = 0;
  563. X    if(mtmp->mtame || mtmp->mfroz ||
  564. X#ifndef NOWORM
  565. X       mtmp->wormno ||
  566. X#endif
  567. X       mtmp->isshk || mtmp->isgd || index(" @12", mtmp->data->mlet))
  568. X        return(0);            /* no tame long worms? */
  569. X    if(obj) {
  570. X        if(dogfood(obj) >= MANFOOD) return(0);
  571. X        if(cansee(mtmp->mx,mtmp->my)){
  572. X            pline("%s devours the %s.", Monnam(mtmp),
  573. X                objects[obj->otyp].oc_name);
  574. X        }
  575. X        obfree(obj, (struct obj *) 0);
  576. X    }
  577. X    mtmp2 = newmonst(sizeof(struct edog) + mtmp->mnamelth);
  578. X    *mtmp2 = *mtmp;
  579. X    mtmp2->mxlth = sizeof(struct edog);
  580. X    if(mtmp->mnamelth) (void) strcpy(NAME(mtmp2), NAME(mtmp));
  581. X    initedog(mtmp2);
  582. X    replmon(mtmp,mtmp2);
  583. X    return(1);
  584. X}
  585. END_OF_dog.c
  586. if test 4228 -ne `wc -c <dog.c`; then
  587.     echo shar: \"dog.c\" unpacked with wrong size!
  588. fi
  589. # end of overwriting check
  590. fi
  591. if test -f mkobj.c -a "${1}" != "-c" ; then 
  592.   echo shar: Will not over-write existing file \"mkobj.c\"
  593. else
  594. echo shar: Extracting \"mkobj.c\" \(3448 characters\)
  595. sed "s/^X//" >mkobj.c <<'END_OF_mkobj.c'
  596. X/*    SCCS Id: @(#)mkobj.c    1.3    87/07/14
  597. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  598. X/* mkobj.c - version 1.0.3 */
  599. X
  600. X#include "hack.h"
  601. X#ifdef SPELLS
  602. Xchar mkobjstr[] = "))[[!!!!????+%%%%/=**))[[!!!!????+%%%%/=**(%";
  603. X#else
  604. Xchar mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%";
  605. X#endif
  606. X
  607. Xstruct obj *mkobj(), *mksobj();
  608. X
  609. Xstruct obj *
  610. Xmkobj_at(let,x,y)
  611. Xregister let,x,y;
  612. X{
  613. X    register struct obj *otmp = mkobj(let);
  614. X    otmp->ox = x;
  615. X    otmp->oy = y;
  616. X    otmp->nobj = fobj;
  617. X    fobj = otmp;
  618. X    return(otmp);
  619. X}
  620. X
  621. Xmksobj_at(otyp,x,y)
  622. Xregister otyp,x,y;
  623. X{
  624. X    register struct obj *otmp = mksobj(otyp);
  625. X    otmp->ox = x;
  626. X    otmp->oy = y;
  627. X    otmp->nobj = fobj;
  628. X    fobj = otmp;
  629. X}
  630. X
  631. Xstruct obj *
  632. Xmkobj(let) {
  633. Xint realtype;
  634. X    switch (let) {
  635. X        case 0: {
  636. X            realtype=probtype(mkobjstr[rn2(sizeof(mkobjstr)-1)]);
  637. X            break;
  638. X        }
  639. X        case '9': { realtype = DEAD_GIANT; break; }
  640. X        case '&': { realtype = DEAD_DEMON; break; }
  641. X        default: realtype = letter(let) ?
  642. X                CORPSE + ((let>'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@'))
  643. X            :    probtype(let);
  644. X    }
  645. X    return(mksobj(realtype));
  646. X}
  647. X    
  648. X
  649. Xstruct obj zeroobj;
  650. X
  651. Xstruct obj *
  652. Xmksobj(otyp)
  653. Xregister otyp;
  654. X{
  655. X    register struct obj *otmp;
  656. X    char let = objects[otyp].oc_olet;
  657. X
  658. X    otmp = newobj(0);
  659. X    *otmp = zeroobj;
  660. X    otmp->age = moves;
  661. X    otmp->o_id = flags.ident++;
  662. X    otmp->quan = 1;
  663. X    otmp->olet = let;
  664. X    otmp->otyp = otyp;
  665. X    otmp->dknown = index(
  666. X#ifdef KAA
  667. X#ifdef SPELLS
  668. X    "/=!?*+)",
  669. X#else
  670. X    "/=!?*)",
  671. X#endif
  672. X#else
  673. X#ifdef SPELLS
  674. X    "/=!?*+",
  675. X#else
  676. X    "/=!?*",
  677. X#endif
  678. X#endif
  679. X            let) ? 0 : 1;
  680. X    switch(let) {
  681. X    case WEAPON_SYM:
  682. X        otmp->quan = (otmp->otyp <= ROCK) ? rn1(6,6) : 1;
  683. X        if(!rn2(11)) otmp->spe = rnd(3);
  684. X        else if(!rn2(10)) {
  685. X            otmp->cursed = 1;
  686. X            otmp->spe = -rnd(3);
  687. X        }
  688. X        break;
  689. X    case FOOD_SYM:
  690. X        if(otmp->otyp >= CORPSE) break;
  691. X#ifdef NOT_YET_IMPLEMENTED
  692. X        /* if tins are to be identified, need to adapt doname() etc */
  693. X        if(otmp->otyp == TIN)
  694. X            otmp->spe = rnd(...);
  695. X#endif
  696. X        /* fall into next case */
  697. X    case GEM_SYM:
  698. X        otmp->quan = rn2(6) ? 1 : 2;
  699. X    case TOOL_SYM:
  700. X    case CHAIN_SYM:
  701. X    case BALL_SYM:
  702. X    case ROCK_SYM:
  703. X    case POTION_SYM:
  704. X    case SCROLL_SYM:
  705. X    case AMULET_SYM:
  706. X        break;
  707. X#ifdef SPELLS
  708. X    case SPBOOK_SYM:
  709. X        if(!rn2(17)) otmp->cursed = 1;
  710. X        break;
  711. X#endif
  712. X    case ARMOR_SYM:
  713. X        if(!rn2(8)) otmp->cursed = 1;
  714. X        if(!rn2(10)) otmp->spe = rnd(3);
  715. X        else if(!rn2(9)) {
  716. X            otmp->spe = -rnd(3);
  717. X            otmp->cursed = 1;
  718. X        }
  719. X        break;
  720. X    case WAND_SYM:
  721. X        if(otmp->otyp == WAN_WISHING) otmp->spe = 3; else
  722. X        otmp->spe = rn1(5,
  723. X            (objects[otmp->otyp].bits & NODIR) ? 11 : 4);
  724. X        break;
  725. X    case RING_SYM:
  726. X        if(objects[otmp->otyp].bits & SPEC) {
  727. X            if(!rn2(3)) {
  728. X                otmp->cursed = 1;
  729. X                otmp->spe = -rnd(2);
  730. X            } else otmp->spe = rnd(2);
  731. X        } else if(otmp->otyp == RIN_TELEPORTATION ||
  732. X              otmp->otyp == RIN_AGGRAVATE_MONSTER ||
  733. X              otmp->otyp == RIN_HUNGER || !rn2(9))
  734. X            otmp->cursed = 1;
  735. X        break;
  736. X    default:
  737. X        panic("impossible mkobj %d", otmp->otyp);
  738. X    }
  739. X    otmp->owt = weight(otmp);
  740. X    return(otmp);
  741. X}
  742. X
  743. Xletter(c) {
  744. X    return(('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z'));
  745. X}
  746. X
  747. Xweight(obj)
  748. Xregister struct obj *obj;
  749. X{
  750. Xregister int wt = objects[obj->otyp].oc_weight;
  751. X    return(wt ? wt*obj->quan : (obj->quan + 1)/2);
  752. X}
  753. X
  754. Xmkgold(num,x,y)
  755. Xregister long num;
  756. X{
  757. X    register struct gold *gold;
  758. X    register long amount = (num ? num : 1 + (rnd(dlevel+2) * rnd(30)));
  759. X
  760. X    if(gold = g_at(x,y))
  761. X        gold->amount += amount;
  762. X    else {
  763. X        gold = newgold();
  764. X        gold->ngold = fgold;
  765. X        gold->gx = x;
  766. X        gold->gy = y;
  767. X        gold->amount = amount;
  768. X        fgold = gold;
  769. X        /* do sth with display? */
  770. X    }
  771. X}
  772. END_OF_mkobj.c
  773. if test 3448 -ne `wc -c <mkobj.c`; then
  774.     echo shar: \"mkobj.c\" unpacked with wrong size!
  775. fi
  776. # end of overwriting check
  777. fi
  778. if test -f monst.c -a "${1}" != "-c" ; then 
  779.   echo shar: Will not over-write existing file \"monst.c\"
  780. else
  781. echo shar: Extracting \"monst.c\" \(3849 characters\)
  782. sed "s/^X//" >monst.c <<'END_OF_monst.c'
  783. X/*    SCCS Id: @(#)monst.c    1.3    87/07/14
  784. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  785. X/* monst.c - version 1.0.2 */
  786. X
  787. X#include "hack.h"
  788. X#include "eshk.h"
  789. Xextern char plname[PL_NSIZ];
  790. X
  791. Xstruct permonst mons[CMNUM+2] = {
  792. X    { "bat",        'B',  1, 22, 8,  0, 1,  4, 0 },
  793. X    { "gnome",        'G',  1,  6, 5,  0, 1,  6, 0 },
  794. X    { "hobgoblin",        'H',  1,  9, 5,  0, 1,  8, 0 },
  795. X    { "jackal",        'J',  0, 12, 7,  0, 1,  2, 0 },
  796. X#ifdef KOPS
  797. X    { "Keystone Kop",       'K',  1,  6, 7, 10, 1,  4, 0 },
  798. X#else
  799. X    { "kobold",        'K',  1,  6, 7,  0, 1,  4, 0 },
  800. X#endif
  801. X    { "leprechaun",        'L',  5, 15, 8, 20, 1,  2, 0 },
  802. X#ifndef ROCKMOLE
  803. X    { "giant rat",        'r',  0, 12, 7,  0, 1,  3, 0 },
  804. X#endif
  805. X    { "acid blob",        'a',  2,  3, 8,  0, 0,  0, 0 },
  806. X    { "floating eye",    'E',  2,  1, 9, 10, 0,  0, 0 },
  807. X    { "homunculus",        'h',  2,  6, 6, 10, 1,  3, 0 },
  808. X    { "imp",        'i',  2,  6, 2, 20, 1,  4, 0 },
  809. X    { "orc",        'O',  2,  9, 6,  0, 1,  8, 0 },
  810. X    { "yellow light",    'y',  3, 15, 0,  0, 0,  0, 0 },
  811. X    { "zombie",        'Z',  2,  6, 8,  0, 1,  8, 0 },
  812. X    { "giant ant",        'A',  3, 18, 3,  0, 1,  6, 0 },
  813. X#ifdef ROCKMOLE
  814. X    { "rock mole",          'r',  3,  3, 0, 20, 1,  6, 0 },
  815. X#endif
  816. X    { "fog cloud",        'f',  3,  1, 0,  0, 1,  6, 0 },
  817. X    { "nymph",        'N',  6, 12, 9, 20, 1,  2, 0 },
  818. X    { "piercer",        'p',  3,  1, 3,  0, 2,  6, 0 },
  819. X#ifdef KAA
  820. X    { "quantum mechanic",    'Q',  6, 12, 3, 10, 1,  4, 0 },
  821. X#else
  822. X    { "quasit",        'Q',  3, 15, 3, 20, 1,  4, 0 },
  823. X#endif
  824. X    { "quivering blob",    'q',  3,  1, 8,  0, 1,  8, 0 },
  825. X#ifdef KAA
  826. X    { "violet fungus",    'v',  3,  1, 7,  0, 1,  4, 0 },
  827. X#else
  828. X    { "violet fungi",    'v',  3,  1, 7,  0, 1,  4, 0 },
  829. X#endif
  830. X    { "giant beetle",    'b',  4,  6, 4,  0, 3,  4, 0 },
  831. X    { "centaur",        'C',  4, 18, 4, 10, 1,  6, 0 },
  832. X    { "cockatrice",        'c',  4,  6, 6, 30, 1,  3, 0 },
  833. X    { "gelatinous cube",    'g',  4,  6, 8,  0, 2,  4, 0 },
  834. X    { "jaguar",        'j',  4, 15, 6,  0, 1,  8, 0 },
  835. X    { "killer bee",        'k',  4, 14, 4,  0, 2,  4, 0 },
  836. X    { "snake",        'S',  4, 15, 3,  0, 1,  6, 0 },
  837. X    { "freezing sphere",    'F',  2, 13, 4,  0, 0,  0, 0 },
  838. X    { "owlbear",        'o',  5, 12, 5,  0, 2,  6, 0 },
  839. X    { "rust monster",    'R', 10, 18, 3,  0, 0,  0, 0 },
  840. X#ifdef SPIDERS
  841. X    { "giant spider",    's',  5, 15, 3,  0, 1,  4, 0 },
  842. X#else
  843. X    { "scorpion",        's',  5, 15, 3,  0, 1,  4, 0 },
  844. X#endif
  845. X    { "tengu",        't',  5, 13, 5, 30, 1,  7, 0 },
  846. X    { "wraith",        'W',  5, 12, 5, 15, 1,  6, 0 },
  847. X#ifdef NOWORM
  848. X    { "wumpus",        'w',  8,  3, 2, 10, 3,  6, 0 },
  849. X#else
  850. X    { "long worm",        'w',  8,  3, 5, 10, 1,  4, 0 },
  851. X#endif
  852. X    { "large dog",        'd',  6, 15, 4,  0, 2,  4, 0 },
  853. X    { "leocrotta",        'l',  6, 18, 4, 10, 3,  6, 0 },
  854. X    { "mimic",        'M',  7,  3, 7,  0, 3,  4, 0 },
  855. X    { "troll",        'T',  7, 12, 4,  0, 2,  7, 0 },
  856. X    { "unicorn",        'u',  8, 24, 5, 70, 1, 10, 0 },
  857. X    { "yeti",        'Y',  5, 15, 6,  0, 1,  6, 0 },
  858. X    { "stalker",        'I',  8, 12, 3,  0, 4,  4, 0 },
  859. X    { "umber hulk",        'U',  9,  6, 2, 25, 2, 10, 0 },
  860. X    { "vampire",        'V',  8, 12, 1, 25, 1,  6, 0 },
  861. X    { "xorn",        'X',  8,  9,-2, 20, 4,  6, 0 },
  862. X    { "xan",        'x',  7, 18,-2,  0, 2,  4, 0 },
  863. X    { "zruty",        'z',  9,  8, 3,  0, 3,  6, 0 },
  864. X    { "chameleon",        ':',  6,  5, 6, 10, 4,  2, 0 },
  865. X    { "giant",        '9',  9, 18, 5,  0, 2, 12, 0 },
  866. X    { "dragon",        'D', 10,  9,-1, 20, 3,  8, 0 },
  867. X    { "ettin",        'e', 10, 12, 3,  0, 2,  8, 0 },
  868. X    { "lurker above",    '\'',10,  3, 3,  0, 0,  0, 0 },
  869. X    { "nurse",        'n', 11,  6, 0,  0, 2,  6, 0 },
  870. X    { "trapper",        ',', 12,  3, 3,  0, 0,  0, 0 },
  871. X    { "purple worm",    'P', 15,  9, 6, 20, 2,  8, 0 },
  872. X    { "demon",        '&', 10, 12,-4, 30, 1,  4, 0 },
  873. X    { "minotaur",        'm', 15, 15, 6,  0, 4, 10, 0 },
  874. X    { "shopkeeper",     '@', 12, 18, 0, 50, 4,  8, sizeof(struct eshk) }
  875. X};
  876. X
  877. Xstruct permonst pm_ghost = { "ghost", ' ', 10, 3, -5, 50, 1, 1, sizeof(plname) };
  878. Xstruct permonst pm_wizard = { "wizard of Yendor", '1', 15, 12, -2, 70, 1, 12, 0 };
  879. X#ifdef MAIL
  880. Xstruct permonst pm_mail_daemon = { "mail daemon", '2', 100, 1, 10, 127, 0, 0, 0 };
  881. X#endif
  882. Xstruct permonst pm_eel = { "giant eel", ';', 15, 6, -3, 0, 3, 6, 0 };
  883. X
  884. END_OF_monst.c
  885. if test 3849 -ne `wc -c <monst.c`; then
  886.     echo shar: \"monst.c\" unpacked with wrong size!
  887. fi
  888. # end of overwriting check
  889. fi
  890. if test -f pctty.c -a "${1}" != "-c" ; then 
  891.   echo shar: Will not over-write existing file \"pctty.c\"
  892. else
  893. echo shar: Extracting \"pctty.c\" \(3882 characters\)
  894. sed "s/^X//" >pctty.c <<'END_OF_pctty.c'
  895. X/*    SCCS Id: @(#)pctty.c    1.3    87/07/14
  896. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  897. X/* tty.c - (PC) version 1.0.3 */
  898. X/* With thanks to the people who sent code for SYSV - hpscdi!jon,
  899. X   arnold@ucsf-cgl, wcs@bo95b, cbcephus!pds and others. */
  900. X
  901. X#include <stdio.h>
  902. X#include "hack.h"
  903. X
  904. Xstatic char erase_char, kill_char;
  905. X
  906. X/*
  907. X * Get initial state of terminal, set ospeed (for termcap routines)
  908. X * and switch off tab expansion if necessary.
  909. X * Called by startup() in termcap.c and after returning from ! or ^Z
  910. X */
  911. Xgettty(){
  912. X    erase_char = '\b';
  913. X    kill_char = 21;        /* cntl-U */
  914. X    flags.cbreak = TRUE;
  915. X#ifdef DGK
  916. X    disable_ctrlP();    /* turn off ^P processing */
  917. X#endif
  918. X}
  919. X
  920. X/* reset terminal to original state */
  921. Xsettty(s) char *s; {
  922. X    end_screen();
  923. X    if(s) printf(s);
  924. X    (void) fflush(stdout);
  925. X#ifdef DGK
  926. X    enable_ctrlP();        /* turn on ^P processing */
  927. X#endif
  928. X}
  929. X
  930. X
  931. X/* fatal error */
  932. X/*VARARGS1*/
  933. Xerror(s,x,y) char *s; {
  934. X    end_screen();
  935. X    putchar('\n');
  936. X    printf(s,x,y);
  937. X    putchar('\n');
  938. X    exit(1);
  939. X}
  940. X
  941. X/*
  942. X * Read a line closed with '\n' into the array char bufp[BUFSZ].
  943. X * (The '\n' is not stored. The string is closed with a '\0'.)
  944. X * Reading can be interrupted by an escape ('\033') - now the
  945. X * resulting string is "\033".
  946. X */
  947. Xgetlin(bufp)
  948. Xregister char *bufp;
  949. X{
  950. X    register char *obufp = bufp;
  951. X    register int c;
  952. X
  953. X    flags.toplin = 2;        /* nonempty, no --More-- required */
  954. X    for(;;) {
  955. X        (void) fflush(stdout);
  956. X        if((c = getchar()) == EOF) {
  957. X            *bufp = 0;
  958. X            return;
  959. X        }
  960. X        if(c == '\033') {
  961. X            *obufp = c;
  962. X            obufp[1] = 0;
  963. X            return;
  964. X        }
  965. X        if(c == erase_char || c == '\b') {
  966. X            if(bufp != obufp) {
  967. X                bufp--;
  968. X                putstr("\b \b"); /* putsym converts \b */
  969. X            } else    bell();
  970. X        } else if(c == '\n') {
  971. X            *bufp = 0;
  972. X            return;
  973. X        } else if(' ' <= c && c < '\177') {
  974. X                /* avoid isprint() - some people don't have it
  975. X                   ' ' is not always a printing char */
  976. X            *bufp = c;
  977. X            bufp[1] = 0;
  978. X            putstr(bufp);
  979. X            if(bufp-obufp < BUFSZ-1 && bufp-obufp < COLNO)
  980. X                bufp++;
  981. X        } else if(c == kill_char || c == '\177') { /* Robert Viduya */
  982. X                /* this test last - @ might be the kill_char */
  983. X            while(bufp != obufp) {
  984. X                bufp--;
  985. X                putstr("\b \b");
  986. X            }
  987. X        } else
  988. X            bell();
  989. X    }
  990. X}
  991. X
  992. Xgetret() {
  993. X    cgetret("");
  994. X}
  995. X
  996. Xcgetret(s)
  997. Xregister char *s;
  998. X{
  999. X    putsym('\n');
  1000. X    if(flags.standout)
  1001. X        standoutbeg();
  1002. X    putstr("Hit ");
  1003. X    putstr(flags.cbreak ? "space" : "return");
  1004. X    putstr(" to continue: ");
  1005. X    if(flags.standout)
  1006. X        standoutend();
  1007. X    xwaitforspace(s);
  1008. X}
  1009. X
  1010. Xchar morc;    /* tell the outside world what char he used */
  1011. X
  1012. Xxwaitforspace(s)
  1013. Xregister char *s;    /* chars allowed besides space or return */
  1014. X{
  1015. Xregister int c;
  1016. X
  1017. X    morc = 0;
  1018. X    while((c = readchar()) != '\n') {
  1019. X        if(flags.cbreak) {
  1020. X        if(c == ' ') break;
  1021. X        if(s && index(s,c)) {
  1022. X            morc = c;
  1023. X            break;
  1024. X        }
  1025. X        bell();
  1026. X        }
  1027. X    }
  1028. X}
  1029. X
  1030. Xstatic int last_multi;
  1031. X
  1032. Xchar *
  1033. Xparse()
  1034. X{
  1035. X    static char inline[COLNO];
  1036. X    register foo;
  1037. X
  1038. X    flags.move = 1;
  1039. X    if(!Invisible) curs_on_u(); else home();
  1040. X    multi = 0;
  1041. X#ifdef DGK
  1042. X    while((foo = readchar()) >= '0' && foo <= '9') {
  1043. X        multi = 10*multi+foo-'0';
  1044. X        if (multi < 0 || multi > LARGEST_INT)
  1045. X            multi = LARGEST_INT;
  1046. X        if (multi > 9) {
  1047. X            remember_topl();
  1048. X            home();
  1049. X            cl_end();
  1050. X            printf("Count: %d", multi);
  1051. X        }
  1052. X        last_multi = multi;
  1053. X    }
  1054. X# ifdef REDO
  1055. X    if (foo == DOAGAIN || in_doagain)
  1056. X        multi = last_multi;
  1057. X    else {
  1058. X        savech(0);    /* reset input queue */
  1059. X        savech(foo);
  1060. X    }
  1061. X# endif
  1062. X
  1063. X#else /* DGK */
  1064. X
  1065. X    while((foo = readchar()) >= '0' && foo <= '9')
  1066. X        multi = 10*multi+foo-'0';
  1067. X
  1068. X#endif /* DGK */
  1069. X
  1070. X    if(multi) {
  1071. X        multi--;
  1072. X        save_cm = inline;
  1073. X    }
  1074. X    inline[0] = foo;
  1075. X    inline[1] = 0;
  1076. X    if(foo == 'g' || foo == 'G'){
  1077. X        inline[1] = getchar();
  1078. X        savech(inline[1]);
  1079. X        inline[2] = 0;
  1080. X    }
  1081. X    if(foo == 'm' || foo == 'M'){
  1082. X        inline[1] = getchar();
  1083. X        savech(inline[1]);
  1084. X        inline[2] = 0;
  1085. X    }
  1086. X    clrlin();
  1087. X    return(inline);
  1088. X}
  1089. X
  1090. Xchar
  1091. Xreadchar() {
  1092. X    register int sym;
  1093. X
  1094. X    (void) fflush(stdout);
  1095. X    sym = getchar();
  1096. X    if(flags.toplin == 1)
  1097. X        flags.toplin = 2;
  1098. X    return((char) sym);
  1099. X}
  1100. END_OF_pctty.c
  1101. if test 3882 -ne `wc -c <pctty.c`; then
  1102.     echo shar: \"pctty.c\" unpacked with wrong size!
  1103. fi
  1104. # end of overwriting check
  1105. fi
  1106. if test -f pray.c -a "${1}" != "-c" ; then 
  1107.   echo shar: Will not over-write existing file \"pray.c\"
  1108. else
  1109. echo shar: Extracting \"pray.c\" \(4040 characters\)
  1110. sed "s/^X//" >pray.c <<'END_OF_pray.c'
  1111. X/*    SCCS Id: @(#)pray.c    1.3    87/07/14
  1112. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1113. X/* pray.c - version 1.0 */
  1114. X
  1115. X#include "hack.h"
  1116. X
  1117. Xextern char *nomovemsg;
  1118. X/*
  1119. X#ifdef KAA
  1120. Xextern char *xname();
  1121. X#endif
  1122. X*/
  1123. Xdopray() {        /* M. Stephenson (1.0.3b) */
  1124. X#ifdef PRAYERS
  1125. X    if (u.ublesscnt > 0)  {        /* disturbing the gods too much */
  1126. X
  1127. X        u.ublesscnt += 200;
  1128. X        u.uluck -= 3;
  1129. X        if (u.uluck < LUCKMIN)  u.uluck = LUCKMIN;
  1130. X        if (u.ugangr++)    angrygods();
  1131. X        else {            /* exactly one warning */
  1132. X            pline("A voice booms out: You have angered us,");
  1133. X            pline("Disturb us again at your own risk!");
  1134. X        }
  1135. X    } else  if (u.uluck < 0) angrygods();    /* a bad boy/girl */
  1136. X    else    pleased();                /* or a good boy/girl */
  1137. X#endif
  1138. X    nomovemsg = "You finished your prayer.";
  1139. X    nomul(-3);
  1140. X    return(1);
  1141. X}
  1142. X
  1143. X#ifdef PRAYERS
  1144. Xangrygods() {
  1145. X    register int    tmp;
  1146. X
  1147. X    pline ("You get the felling the gods are angry...");
  1148. X    tmp = u.ugangr + (u.uluck > 0) ? u.uluck : -u.uluck;
  1149. X    switch (tmp ? rn2(tmp): 0) {
  1150. X
  1151. X        case 0:
  1152. X        case 1:    pline("but nothing appears to happen.");
  1153. X            break;
  1154. X        case 2:
  1155. X        case 3:    pline("A voice booms out: You are arrogant, mortal.");
  1156. X            pline("You must relearn your lessons!");
  1157. X            if (u.ulevel > 1)    losexp();
  1158. X            else  {
  1159. X                u.uexp = 0;
  1160. X                flags.botl = 1;
  1161. X            }
  1162. X            break;
  1163. X        case 4:
  1164. X        case 5:
  1165. X        case 6:    pline("A black glow surrounds you.");
  1166. X            rndcurse();
  1167. X            break;
  1168. X        case 7:
  1169. X        case 8:    pline("A voice booms out: You dare to call upon us?");
  1170. X            pline("Then, die mortal!");
  1171. X            mkmon_at('&', u.ux, u.uy);
  1172. X            break;
  1173. X                
  1174. X        default:    pline("Suddenly, a bolt of lightning strikes you!");
  1175. X            pline("You are fried to a crisp.");
  1176. X            killer = "pissed off deity";
  1177. X            done("died");
  1178. X            break;
  1179. X    }
  1180. X    u.ublesscnt = 250;
  1181. X    return(0);
  1182. X}
  1183. X
  1184. Xpleased() {
  1185. X
  1186. X    char    *tmp, *hcolor();
  1187. X
  1188. X    u.ugangr--;
  1189. X    if (u.ugangr < 0) u.ugangr = 0;
  1190. X    pline("You feel the gods are pleased.");
  1191. X
  1192. X    switch(rn2((u.uluck + 6)/2))  {
  1193. X
  1194. X        case 0:    pline("but nothing seems to happen.");
  1195. X            break;
  1196. X        case 1:
  1197. X#ifdef KAA
  1198. X            if(!uwep) {
  1199. X                pline("but nothing seems to happen.");
  1200. X                break;
  1201. X            }
  1202. X            if(uwep->olet == WEAPON_SYM) {
  1203. X                if (uwep->cursed) {
  1204. X                uwep->cursed=0;
  1205. X                pline("Your %s %s.", aobjnam(uwep,"softly glow"), 
  1206. X                Hallucination ? hcolor() : "amber");
  1207. X                } else if(uwep->otyp >= ARROW && uwep->otyp <= SPEAR) {
  1208. X                uwep->dknown=1;
  1209. X                tmp = Hallucination ? hcolor() : "light blue";
  1210. X                pline("Your %s with a%s %s aura.", aobjnam(uwep,"softly glow"),
  1211. X                index("aeiou",*tmp) ? "n" : "", tmp);
  1212. X                }
  1213. X            } else
  1214. X#endif
  1215. X                pline("but nothing seems to happen.");
  1216. X            break;
  1217. X        case 2:
  1218. X        case 3:
  1219. X            pline("A %s glow surrounds you",
  1220. X                  Hallucination ? hcolor() : "golden");
  1221. X            u.uhp = u.uhpmax += 5;
  1222. X            u.ustr = u.ustrmax;
  1223. X            if (u.uhunger < 900)    init_uhunger();
  1224. X            if (u.uluck < 0)    u.uluck = 0;
  1225. X            if (Blind)        Blind = 1;
  1226. X            break;
  1227. X        case 4:
  1228. X        case 5:    pline("A voice booms out: We are pleased with your progress,");
  1229. X            pline("and grant you the gift of");
  1230. X            if (!(HTelepat & INTRINSIC))  {
  1231. X                HTelepat = HTelepat || INTRINSIC;
  1232. X                pline ("Telepathy,");
  1233. X            } else if (!(Fast & INTRINSIC))  {
  1234. X                Fast = Fast || INTRINSIC;
  1235. X                pline ("Speed,");
  1236. X            } else if (!(Stealth & INTRINSIC))  {
  1237. X                Stealth = Stealth || INTRINSIC;
  1238. X                pline ("Stealth,");
  1239. X            } else {
  1240. X                if (!(Protection & INTRINSIC))  {
  1241. X                Protection = Protection || INTRINSIC;
  1242. X                if (!u.ublessed)  u.ublessed = rnd(3) + 1;
  1243. X                } else u.ublessed++;
  1244. X                pline ("our protection,");
  1245. X            }
  1246. X            pline ("Use it wisely in our names!");
  1247. X            break;
  1248. X
  1249. X        case 6:    pline ("An object appears at your feet!");
  1250. X            mkobj_at("+", u.ux, u.uy);
  1251. X            break;
  1252. X
  1253. X        case 7:    pline("A voice booms out:  We crown thee...");
  1254. X            pline("The Hand of Elbereth!");
  1255. X            HInvis |= INTRINSIC;
  1256. X            HSee_invisible |= INTRINSIC;
  1257. X            HFire_resistance |= INTRINSIC;
  1258. X            HCold_resistance |= INTRINSIC;
  1259. X            HPoison_resistance |= INTRINSIC;
  1260. X            break;
  1261. X
  1262. X        default:    impossible("Confused deity!");
  1263. X            break;
  1264. X    }
  1265. X    u.ublesscnt = 300;
  1266. X#ifdef HARD
  1267. X    u.ublesscnt += (u.udemigod * 1000);
  1268. X#endif
  1269. X    return(0);
  1270. X}
  1271. X#endif /* PRAYERS /**/
  1272. X
  1273. END_OF_pray.c
  1274. if test 4040 -ne `wc -c <pray.c`; then
  1275.     echo shar: \"pray.c\" unpacked with wrong size!
  1276. fi
  1277. # end of overwriting check
  1278. fi
  1279. if test -f rumors.kaa -a "${1}" != "-c" ; then 
  1280.   echo shar: Will not over-write existing file \"rumors.kaa\"
  1281. else
  1282. echo shar: Extracting \"rumors.kaa\" \(3523 characters\)
  1283. sed "s/^X//" >rumors.kaa <<'END_OF_rumors.kaa'
  1284. XYou should always be sure to learn about quantum mechanics.
  1285. XAn apple a day keeps the doctor away.
  1286. XA crystal plate mail will not rust.
  1287. XTry using your magic marker on wet scrolls!
  1288. XCrystal plate is the rarest of all.
  1289. XHealers are immune to the effects of nurses.
  1290. XBashing monsters with a bow is not such a good idea.
  1291. XWait!  That's a fortune!
  1292. XEver broken an egg against the ground?
  1293. XFinding traps is a lot like finding gold.
  1294. XFinding potions is a lot like finding food.
  1295. XRust traps are harmless if you are wearing an elven cloak.
  1296. XDon't bother trying to control teleports if you are not awake.
  1297. XEver gone into the morgue at midnight?
  1298. XWielding a dead cockatrice may actually work.
  1299. XLeaving the dungeon while hallucinating may get you arrested.
  1300. XDrinking potions of booze may land you in jail if you are under 21.
  1301. XA dilithium crystal is the most valuable mineral around.
  1302. XValkyrie comes from the north, and has commensurate abilities.
  1303. XElf has extra speed.
  1304. XGushes of water won't necessarily hit your head.
  1305. XPlaying Gauntlet might be enlightening in some situations.
  1306. XA short sword is not as good as a long sword.
  1307. XA bardiche is better than a sword.
  1308. XA trident is a nice thing to have.
  1309. XUsing a morning star in the evening has no effect.
  1310. XPolymorphing a shopkeeper might make you safer.
  1311. XYou cannot quench your thirst in a water trap.
  1312. XAfraid of nymphs?  Wear a ring of adornment.
  1313. XGiant bats turn into giant vampires.
  1314. XI wouldn't advise playing catch with a giant.
  1315. XAfraid of your valuables being stolen?  Carry more junk!
  1316. XHoly water has many uses.
  1317. XYou swallowed the fortune!!!
  1318. XYou hear the fortune cookie's hissing!
  1319. XA pie fight.  Now that's fun!
  1320. XMesses attract ants.
  1321. XWhy are you wasting time reading fortunes?
  1322. XHelp!  I'm being held prisoner in a fortune cookie factory!
  1323. XOnly elves can wear elfin chain mail.
  1324. XAre you SURE that's a wand of wishing?
  1325. XCroesus?  Who's he?
  1326. XIf you want a sex change, you must get it before the game.
  1327. XShopkeepers value money more than revenge.
  1328. XShopkeepers can't tell identical twins apart.
  1329. XYou're going into the morgue at midnight????
  1330. XDidn't your mother tell you not to eat food off the floor?
  1331. XTrolls are described as rubbery:  they keep bouncing back.
  1332. XMark your way with a magic marker.
  1333. XA magic marker is like a wand of digging, but less so.
  1334. XA dead cockatrice is just a dead lizard.
  1335. XYou need 512k to implement the magic memory vaults.
  1336. XEveryone's goal is to get to heaven.
  1337. XHeaven can wait.
  1338. XUnused potions are like unburned scrolls.
  1339. XEver read a tin of fire?
  1340. XYou may want to dip into a potion of bottled blessings.
  1341. XTridents are for use underwater.
  1342. XWe have new ways of detecting treachery...
  1343. XCave(wo)men all belong to the same club.
  1344. XIf you thought the wizard was bad, just wait till you meet the Warlord!
  1345. XYou are filled with a feeling of awwwww.
  1346. XValkyries, elves, and wizards need food badly.
  1347. XNetHack was modified by Miracleman (Ken Arromdee).
  1348. XYou may discover a fine spirit inside a potion bottle.
  1349. XLong live Phoenix!
  1350. XMost of the bugs in Hack are on the floor.
  1351. XWhat does a dead demon taste like?
  1352. XIf you kill a ghost, how will you find the body?
  1353. XA ring of dungeon master control is a great find.
  1354. XEver lifted a dead dragon?
  1355. XEver see your weapon glow plaid?
  1356. XPlaying AD&D may be helpful.
  1357. XWhat is a three sided die shaped like?
  1358. XWhat is a zero sided die shaped like?
  1359. XWhat is a cockatrice going to eat when it gets hungry?
  1360. XHitting a giant that is picking up a boulder may be difficult.
  1361. XA softly glowing weapon can kill a demon.
  1362. XThe orc swings his two handed sword named Elfrist at you.  You die...
  1363. XZap yourself and see what happens...
  1364. END_OF_rumors.kaa
  1365. if test 3523 -ne `wc -c <rumors.kaa`; then
  1366.     echo shar: \"rumors.kaa\" unpacked with wrong size!
  1367. fi
  1368. # end of overwriting check
  1369. fi
  1370. if test -f search.c -a "${1}" != "-c" ; then 
  1371.   echo shar: Will not over-write existing file \"search.c\"
  1372. else
  1373. echo shar: Extracting \"search.c\" \(3458 characters\)
  1374. sed "s/^X//" >search.c <<'END_OF_search.c'
  1375. X/*    SCCS Id: @(#)search.c    1.3    87/07/14
  1376. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1377. X/* search.c - version 1.0.3 */
  1378. X
  1379. X#include "hack.h"
  1380. Xchar *rndmonnam(), *defmonnam();
  1381. X
  1382. Xextern struct monst *makemon();
  1383. X
  1384. Xfindit()    /* returns number of things found */
  1385. X{
  1386. X    int num;
  1387. X    register xchar zx,zy;
  1388. X    register struct trap *ttmp;
  1389. X    register struct monst *mtmp;
  1390. X    xchar lx,hx,ly,hy;
  1391. X
  1392. X    if(u.uswallow) return(0);
  1393. X    for(lx = u.ux; (num = levl[lx-1][u.uy].typ) && num != CORR; lx--) ;
  1394. X    for(hx = u.ux; (num = levl[hx+1][u.uy].typ) && num != CORR; hx++) ;
  1395. X    for(ly = u.uy; (num = levl[u.ux][ly-1].typ) && num != CORR; ly--) ;
  1396. X    for(hy = u.uy; (num = levl[u.ux][hy+1].typ) && num != CORR; hy++) ;
  1397. X    num = 0;
  1398. X    for(zy = ly; zy <= hy; zy++)
  1399. X        for(zx = lx; zx <= hx; zx++) {
  1400. X            if(levl[zx][zy].typ == SDOOR) {
  1401. X                levl[zx][zy].typ = DOOR;
  1402. X#ifdef DGK
  1403. X                atl(zx, zy, symbol.door);
  1404. X#else
  1405. X                atl(zx, zy, '+');
  1406. X#endif
  1407. X                num++;
  1408. X            } else if(levl[zx][zy].typ == SCORR) {
  1409. X                levl[zx][zy].typ = CORR;
  1410. X#ifdef DGK
  1411. X                atl(zx, zy, symbol.corr);
  1412. X#else
  1413. X                atl(zx, zy, CORR_SYM);
  1414. X#endif
  1415. X                num++;
  1416. X            } else if(ttmp = t_at(zx, zy)) {
  1417. X                if(ttmp->ttyp == PIERC){
  1418. X                    (void) makemon(PM_PIERCER, zx, zy);
  1419. X                    num++;
  1420. X                    deltrap(ttmp);
  1421. X                } else if(!ttmp->tseen) {
  1422. X                    ttmp->tseen = 1;
  1423. X                    if(!vism_at(zx, zy))
  1424. X                        atl(zx,zy,'^');
  1425. X                    num++;
  1426. X                }
  1427. X            } else if(mtmp = m_at(zx,zy)) if(mtmp->mimic){
  1428. X                seemimic(mtmp);
  1429. X                num++;
  1430. X            }
  1431. X        }
  1432. X    return(num);
  1433. X}
  1434. X
  1435. Xdosearch()
  1436. X{
  1437. X    register xchar x,y;
  1438. X    register struct trap *trap;
  1439. X    register struct monst *mtmp;
  1440. X
  1441. X    if(u.uswallow)
  1442. X        pline("What are you looking for? The exit?");
  1443. X    else
  1444. X    for(x = u.ux-1; x < u.ux+2; x++)
  1445. X    for(y = u.uy-1; y < u.uy+2; y++) if(x != u.ux || y != u.uy) {
  1446. X        if(levl[x][y].typ == SDOOR) {
  1447. X            if(rn2(7)) continue;
  1448. X            levl[x][y].typ = DOOR;
  1449. X            levl[x][y].seen = 0;    /* force prl */
  1450. X            prl(x,y);
  1451. X            nomul(0);
  1452. X        } else if(levl[x][y].typ == SCORR) {
  1453. X            if(rn2(7)) continue;
  1454. X            levl[x][y].typ = CORR;
  1455. X            levl[x][y].seen = 0;    /* force prl */
  1456. X            prl(x,y);
  1457. X            nomul(0);
  1458. X        } else {
  1459. X        /* Be careful not to find anything in an SCORR or SDOOR */
  1460. X            if(mtmp = m_at(x,y)) if(mtmp->mimic){
  1461. X                seemimic(mtmp);
  1462. X                pline("You find %s.",defmonnam(mtmp));
  1463. X                return(1);
  1464. X            }
  1465. X            for(trap = ftrap; trap; trap = trap->ntrap)
  1466. X            if(trap->tx == x && trap->ty == y &&
  1467. X               !trap->tseen && !rn2(8)) {
  1468. X                nomul(0);
  1469. X                if (trap->ttyp != PIERC)
  1470. X                pline("You find a%s.", traps[Hallucination ?
  1471. X                rn2(TRAPNUM-2) : trap->ttyp ]);
  1472. X
  1473. X                if(trap->ttyp == PIERC) {
  1474. X                    deltrap(trap);
  1475. X                    mtmp=makemon(PM_PIERCER,x,y);
  1476. X                    pline("You find %s.", defmonnam(mtmp));
  1477. X                    return(1);
  1478. X                }
  1479. X                trap->tseen = 1;
  1480. X                if(!vism_at(x,y)) atl(x,y,'^');
  1481. X            }
  1482. X        }
  1483. X    }
  1484. X    return(1);
  1485. X}
  1486. X
  1487. Xdoidtrap() {
  1488. Xregister struct trap *trap;
  1489. Xregister int x,y;
  1490. X    if(!getdir(1)) return(0);
  1491. X    x = u.ux + u.dx;
  1492. X    y = u.uy + u.dy;
  1493. X    for(trap = ftrap; trap; trap = trap->ntrap)
  1494. X        if(trap->tx == x && trap->ty == y && trap->tseen) {
  1495. X            if(u.dz)
  1496. X            if((u.dz < 0) != (!xdnstair && trap->ttyp == TRAPDOOR))
  1497. X                continue;
  1498. X            pline("That is a%s.",traps[ Hallucination ? rn2(TRAPNUM-2) :
  1499. X            trap->ttyp]);
  1500. X            return(0);
  1501. X        }
  1502. X    pline("I can't see a trap there.");
  1503. X    return(0);
  1504. X}
  1505. X
  1506. Xwakeup(mtmp)
  1507. Xregister struct monst *mtmp;
  1508. X{
  1509. X    mtmp->msleep = 0;
  1510. X    setmangry(mtmp);
  1511. X    if(mtmp->mimic) seemimic(mtmp);
  1512. X}
  1513. X
  1514. X/* NOTE: we must check if(mtmp->mimic) before calling this routine */
  1515. Xseemimic(mtmp)
  1516. Xregister struct monst *mtmp;
  1517. X{
  1518. X        mtmp->mimic = 0;
  1519. X        mtmp->mappearance = 0;
  1520. X        unpmon(mtmp);
  1521. X        pmon(mtmp);
  1522. X}
  1523. END_OF_search.c
  1524. if test 3458 -ne `wc -c <search.c`; then
  1525.     echo shar: \"search.c\" unpacked with wrong size!
  1526. fi
  1527. # end of overwriting check
  1528. fi
  1529. if test -f sit.c -a "${1}" != "-c" ; then 
  1530.   echo shar: Will not over-write existing file \"sit.c\"
  1531. else
  1532. echo shar: Extracting \"sit.c\" \(3702 characters\)
  1533. sed "s/^X//" >sit.c <<'END_OF_sit.c'
  1534. X/*    SCCS Id: @(#)sit.c    1.3    87/07/14
  1535. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1536. X/* sit.c - version 1.0 */
  1537. X
  1538. X#include "hack.h"
  1539. X
  1540. X#ifdef NEWCLASS
  1541. Xint    identify();
  1542. X
  1543. Xdosit() {
  1544. X    extern struct obj *readobjnam(), *addinv();
  1545. X    register struct    obj    *otmp;
  1546. X    struct     obj    *sobj_at();
  1547. X    register int    cnt;
  1548. X
  1549. X    char    buf[BUFSZ];
  1550. X
  1551. X    if(Levitation)  {
  1552. X
  1553. X        pline("You are floating in the air, you can't sit!");
  1554. X    } else    if(IS_THRONE(levl[u.ux][u.uy].typ)) {
  1555. X
  1556. X        pline("As you sit in the opulant throne");
  1557. X        if (rnd(6) > 4)  {
  1558. X
  1559. X            switch (rnd(13))  {
  1560. X
  1561. X                case 1:
  1562. X                pline("you feel suddenly weaker.");
  1563. X                if(Poison_resistance) {
  1564. X
  1565. X                    losestr(rn1(1,2));
  1566. X                    losehp(rnd(6), "cursed throne");
  1567. X                } else {
  1568. X
  1569. X                    losestr(rn1(4,3));
  1570. X                    losehp(rnd(10), "cursed throne");
  1571. X                }
  1572. X                break;
  1573. X                case 2:
  1574. X                pline("you feel suddenly stronger.");
  1575. X                gainstr(0);
  1576. X                break;
  1577. X                case 3:
  1578. X                pline("A massive charge of electricity shoots through your body!");
  1579. X                losehp(rnd(30), "electric chair");
  1580. X                break;
  1581. X                case 4:
  1582. X                pline("you feel much, much better!");
  1583. X                if(u.uhp >= (u.uhpmax - 5))  u.uhpmax += 4;
  1584. X                u.uhp = u.uhpmax;
  1585. X                if (Blind) Blind = 1;
  1586. X                if (Sick)  Sick = 0;
  1587. X                flags.botl = 1;
  1588. X                break;
  1589. X                case 5:
  1590. X                if (u.ugold <= 0)  {
  1591. X
  1592. X                    pline("you feel a strange sensation.");
  1593. X                } else {
  1594. X                    pline("you notice you have no gold!");
  1595. X                    u.ugold = 0;
  1596. X                    flags.botl = 1;
  1597. X                }
  1598. X                break;
  1599. X                case 6:
  1600. X                if(u.uluck + rn2(5) < 0) {
  1601. X
  1602. X                    pline("you feel your luck is changing.");
  1603. X                    u.uluck++;
  1604. X                } else        makewish();
  1605. X                break;
  1606. X                case 7:
  1607. X                cnt = rnd(10);
  1608. X                pline("you hear a voice echo:");
  1609. X                pline("Your audience has been summoned, Sire!");
  1610. X                while(cnt--)
  1611. X                    (void) makemon(courtmon(), u.ux, u.uy);
  1612. X                break;
  1613. X                case 8:
  1614. X                if (Confusion != 0)  {
  1615. X
  1616. X                    pline("you hear a voice echo:");
  1617. X                    pline("By your Imperious order Sire...");
  1618. X                }
  1619. X                do_genocide();
  1620. X                break;
  1621. X                case 9:
  1622. X                pline("you hear a voice echo:");
  1623. X                pline("A curse upon you for sitting upon this most holy throne!");
  1624. X                if (u.uluck > 0)  {
  1625. X
  1626. X                    if(!Blind)    pline("a cloud of darkness falls upon you.");
  1627. X                    Blind += rn1(100,250);
  1628. X                    seeoff(0);
  1629. X                } else        rndcurse();
  1630. X                break;
  1631. X                case 10:
  1632. X                if (u.uluck < 0)  {
  1633. X
  1634. X                    pline("an image forms in your mind.");
  1635. X                    do_mapping();
  1636. X                } else  {
  1637. X
  1638. X                    pline("your vision clarifies.");
  1639. X                    HSee_invisible |= INTRINSIC;
  1640. X                }
  1641. X                break;
  1642. X                case 11:
  1643. X                if (u.uluck < 0)  {
  1644. X
  1645. X                    pline("you feel threatened.");
  1646. X                    aggravate();
  1647. X                } else  {
  1648. X
  1649. X                    pline("you feel a wrenching sensation.");
  1650. X                    tele();        /* teleport him */
  1651. X                }
  1652. X                break;
  1653. X                case 12:
  1654. X                pline("you are granted a gift of insight!");
  1655. X                while (!ggetobj("identify", identify, rn2(5))
  1656. X                    && invent);
  1657. X                break;
  1658. X                case 13:
  1659. X                pline("your mind turns into a pretzel!");
  1660. X                HConfusion += rn1(7,16);
  1661. X                break;
  1662. X                default:    impossible("throne effect");
  1663. X                    break;
  1664. X            }
  1665. X        } else    pline("you feel somehow out of place...");
  1666. X
  1667. X        if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ))    {
  1668. X
  1669. X            pline("The throne vanishes in a puff of logic.");
  1670. X/*            levl[u.ux][u.uy].scrsym = '.'; */
  1671. X            levl[u.ux][u.uy].typ = ROOM;
  1672. X        }
  1673. X
  1674. X    } else    pline("Having fun sitting on the floor???");
  1675. X    return(1);
  1676. X}
  1677. X#endif /* NEWCLASS /**/
  1678. X
  1679. X#if defined(NEWCLASS) || defined(PRAYERS) || defined(HARD)
  1680. Xrndcurse() {            /* curse a few inventory items at random! */
  1681. X
  1682. X    int    nobj = 0;
  1683. X    int    cnt, onum;
  1684. X    struct    obj    *otmp;
  1685. X
  1686. X    for (otmp = invent; otmp; otmp = otmp->nobj)  nobj++;
  1687. X        for (cnt = rnd(6); cnt > 0; cnt--)  {
  1688. X
  1689. X        onum = rn2(nobj);
  1690. X        for(otmp = invent; onum != 0; onum--)
  1691. X            otmp = otmp->nobj;
  1692. X
  1693. X            otmp->cursed++;
  1694. X        }
  1695. X}
  1696. X#endif
  1697. END_OF_sit.c
  1698. if test 3702 -ne `wc -c <sit.c`; then
  1699.     echo shar: \"sit.c\" unpacked with wrong size!
  1700. fi
  1701. # end of overwriting check
  1702. fi
  1703. if test -f topl.c -a "${1}" != "-c" ; then 
  1704.   echo shar: Will not over-write existing file \"topl.c\"
  1705. else
  1706. echo shar: Extracting \"topl.c\" \(3941 characters\)
  1707. sed "s/^X//" >topl.c <<'END_OF_topl.c'
  1708. X/*    SCCS Id: @(#)topl.c    1.3    87/07/14
  1709. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  1710. X/* topl.c - version 1.0.2 */
  1711. X
  1712. X#include <stdio.h>
  1713. X#include "hack.h"
  1714. Xextern char *eos();
  1715. Xextern int CO;
  1716. X
  1717. Xchar toplines[BUFSZ];
  1718. Xxchar tlx, tly;            /* set by pline; used by addtopl */
  1719. X
  1720. Xstruct topl {
  1721. X    struct topl *next_topl;
  1722. X    char *topl_text;
  1723. X} *old_toplines, *last_redone_topl;
  1724. X#define    OTLMAX    20        /* max nr of old toplines remembered */
  1725. X
  1726. Xdoredotopl(){
  1727. X    if(last_redone_topl)
  1728. X        last_redone_topl = last_redone_topl->next_topl;
  1729. X    if(!last_redone_topl)
  1730. X        last_redone_topl = old_toplines;
  1731. X    if(last_redone_topl){
  1732. X        (void) strcpy(toplines, last_redone_topl->topl_text);
  1733. X    }
  1734. X    redotoplin();
  1735. X    return(0);
  1736. X}
  1737. X
  1738. Xredotoplin() {
  1739. X    home();
  1740. X    if(index(toplines, '\n')) cl_end();
  1741. X    putstr(toplines);
  1742. X    cl_end();
  1743. X    tlx = curx;
  1744. X    tly = cury;
  1745. X    flags.toplin = 1;
  1746. X    if(tly > 1)
  1747. X        more();
  1748. X}
  1749. X
  1750. Xremember_topl() {
  1751. Xregister struct topl *tl;
  1752. Xregister int cnt = OTLMAX;
  1753. X    if(last_redone_topl &&
  1754. X       !strcmp(toplines, last_redone_topl->topl_text)) return;
  1755. X    if(old_toplines &&
  1756. X       !strcmp(toplines, old_toplines->topl_text)) return;
  1757. X    last_redone_topl = 0;
  1758. X    tl = (struct topl *)
  1759. X        alloc((unsigned)(strlen(toplines) + sizeof(struct topl) + 1));
  1760. X    tl->next_topl = old_toplines;
  1761. X    tl->topl_text = (char *)(tl + 1);
  1762. X    (void) strcpy(tl->topl_text, toplines);
  1763. X    old_toplines = tl;
  1764. X    while(cnt && tl){
  1765. X        cnt--;
  1766. X        tl = tl->next_topl;
  1767. X    }
  1768. X    if(tl && tl->next_topl){
  1769. X        free((char *) tl->next_topl);
  1770. X        tl->next_topl = 0;
  1771. X    }
  1772. X}
  1773. X
  1774. Xaddtopl(s) char *s; {
  1775. X    curs(tlx,tly);
  1776. X    if(tlx + strlen(s) > CO) putsym('\n');
  1777. X    putstr(s);
  1778. X    tlx = curx;
  1779. X    tly = cury;
  1780. X    flags.toplin = 1;
  1781. X}
  1782. X
  1783. Xxmore(s)
  1784. Xchar *s;    /* allowed chars besides space/return */
  1785. X{
  1786. X    if(flags.toplin) {
  1787. X        curs(tlx, tly);
  1788. X        if(tlx + 8 > CO) putsym('\n'), tly++;
  1789. X    }
  1790. X
  1791. X    if(flags.standout)
  1792. X        standoutbeg();
  1793. X    putstr("--More--");
  1794. X    if(flags.standout)
  1795. X        standoutend();
  1796. X
  1797. X    xwaitforspace(s);
  1798. X    if(flags.toplin && tly > 1) {
  1799. X        home();
  1800. X        cl_end();
  1801. X        docorner(1, tly-1);
  1802. X    }
  1803. X    flags.toplin = 0;
  1804. X}
  1805. X
  1806. Xmore(){
  1807. X    xmore("");
  1808. X}
  1809. X
  1810. Xcmore(s)
  1811. Xregister char *s;
  1812. X{
  1813. X    xmore(s);
  1814. X}
  1815. X
  1816. Xclrlin(){
  1817. X    if(flags.toplin) {
  1818. X        home();
  1819. X        cl_end();
  1820. X        if(tly > 1) docorner(1, tly-1);
  1821. X        remember_topl();
  1822. X    }
  1823. X    flags.toplin = 0;
  1824. X}
  1825. X
  1826. X/*VARARGS1*/
  1827. X/* Because the modified mstatusline has 9 arguments KAA */
  1828. Xpline(line,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
  1829. Xregister char *line,*arg1,*arg2,*arg3,*arg4,*arg5,*arg6,*arg7,*arg8,*arg9;
  1830. X{
  1831. X    char pbuf[BUFSZ];
  1832. X    register char *bp = pbuf, *tl;
  1833. X    register int n,n0;
  1834. X
  1835. X    if(!line || !*line) return;
  1836. X    if(!index(line, '%')) (void) strcpy(pbuf,line); else
  1837. X    (void) sprintf(pbuf,line,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
  1838. X    if(flags.toplin == 1 && !strcmp(pbuf, toplines)) return;
  1839. X    nscr();        /* %% */
  1840. X
  1841. X    /* If there is room on the line, print message on same line */
  1842. X    /* But messages like "You die..." deserve their own line */
  1843. X    n0 = strlen(bp);
  1844. X    if(flags.toplin == 1 && tly == 1 &&
  1845. X        n0 + strlen(toplines) + 3 < CO-8 &&  /* leave room for --More-- */
  1846. X        strncmp(bp, "You ", 4)) {
  1847. X        (void) strcat(toplines, "  ");
  1848. X        (void) strcat(toplines, bp);
  1849. X        tlx += 2;
  1850. X        addtopl(bp);
  1851. X        return;
  1852. X    }
  1853. X    if(flags.toplin == 1) more();
  1854. X    remember_topl();
  1855. X    toplines[0] = 0;
  1856. X    while(n0){
  1857. X        if(n0 >= CO){
  1858. X            /* look for appropriate cut point */
  1859. X            n0 = 0;
  1860. X            for(n = 0; n < CO; n++) if(bp[n] == ' ')
  1861. X                n0 = n;
  1862. X            if(!n0) for(n = 0; n < CO-1; n++)
  1863. X                if(!letter(bp[n])) n0 = n;
  1864. X            if(!n0) n0 = CO-2;
  1865. X        }
  1866. X        (void) strncpy((tl = eos(toplines)), bp, n0);
  1867. X        tl[n0] = 0;
  1868. X        bp += n0;
  1869. X
  1870. X        /* remove trailing spaces, but leave one */
  1871. X        while(n0 > 1 && tl[n0-1] == ' ' && tl[n0-2] == ' ')
  1872. X            tl[--n0] = 0;
  1873. X
  1874. X        n0 = strlen(bp);
  1875. X        if(n0 && tl[0]) (void) strcat(tl, "\n");
  1876. X    }
  1877. X    redotoplin();
  1878. X}
  1879. X
  1880. Xputsym(c) char c; {
  1881. X    switch(c) {
  1882. X    case '\b':
  1883. X        backsp();
  1884. X        return;
  1885. X    case '\n':
  1886. X        curx = 1;
  1887. X        cury++;
  1888. X        if(cury > tly) tly = cury;
  1889. X        break;
  1890. X    default:
  1891. X        if(curx == CO)
  1892. X            putsym('\n');    /* 1 <= curx <= CO; avoid CO */
  1893. X        else
  1894. X            curx++;
  1895. X    }
  1896. X    (void) putchar(c);
  1897. X}
  1898. X
  1899. Xputstr(s) register char *s; {
  1900. X    while(*s) putsym(*s++);
  1901. X}
  1902. END_OF_topl.c
  1903. if test 3941 -ne `wc -c <topl.c`; then
  1904.     echo shar: \"topl.c\" unpacked with wrong size!
  1905. fi
  1906. # end of overwriting check
  1907. fi
  1908. if test -f write.c -a "${1}" != "-c" ; then 
  1909.   echo shar: Will not over-write existing file \"write.c\"
  1910. else
  1911. echo shar: Extracting \"write.c\" \(3864 characters\)
  1912. sed "s/^X//" >write.c <<'END_OF_write.c'
  1913. X/*    SCCS Id: @(#)write.c    1.3    87/07/14
  1914. X/* write.c - version 1.0.3 */
  1915. X
  1916. X#include "hack.h"
  1917. X
  1918. Xextern char pl_character[];
  1919. X
  1920. X#ifdef MARKER
  1921. X
  1922. X/*
  1923. X * returns basecost of a scroll
  1924. X */
  1925. Xint
  1926. Xcost(scroll)
  1927. Xregister struct obj *scroll;
  1928. X{
  1929. X    switch(scroll->otyp)  {
  1930. X# ifdef MAIL
  1931. X    case SCR_MAIL:
  1932. X# endif
  1933. X        return(0);
  1934. X        break;
  1935. X    case SCR_LIGHT:
  1936. X    case SCR_GOLD_DETECTION:
  1937. X    case SCR_FOOD_DETECTION:
  1938. X    case SCR_MAGIC_MAPPING:
  1939. X    case SCR_AMNESIA:
  1940. X    case SCR_FIRE:
  1941. X        return(8);
  1942. X        break;
  1943. X    case SCR_DESTROY_ARMOR:
  1944. X    case SCR_DAMAGE_WEAPON:
  1945. X    case SCR_CREATE_MONSTER:
  1946. X    case SCR_PUNISHMENT:
  1947. X        return(10);
  1948. X        break;
  1949. X    case SCR_CONFUSE_MONSTER:
  1950. X        return(12);
  1951. X        break;
  1952. X    case SCR_IDENTIFY:
  1953. X        return(14);
  1954. X        break;
  1955. X    case SCR_ENCHANT_ARMOR:
  1956. X    case SCR_REMOVE_CURSE:
  1957. X    case SCR_ENCHANT_WEAPON:
  1958. X        return(16);
  1959. X        break;
  1960. X    case SCR_SCARE_MONSTER:
  1961. X    case SCR_TAMING:
  1962. X    case SCR_TELEPORTATION:
  1963. X        return(20);
  1964. X        break;
  1965. X    case SCR_GENOCIDE:
  1966. X        return(30);
  1967. X        break;
  1968. X    case SCR_BLANK_PAPER:
  1969. X    default:
  1970. X        impossible("You can't write such a weird scroll!");
  1971. X        return(1000);
  1972. X    }
  1973. X}
  1974. X
  1975. X
  1976. Xdowrite(pen)
  1977. X    register struct obj *pen;
  1978. X{
  1979. X    register struct obj *paper;
  1980. X    char namebuf[BUFSZ], scrbuf[BUFSZ];
  1981. X    register struct obj *newscroll;
  1982. X    extern struct obj *readobjnam(), *addinv();
  1983. X    int basecost, actualcost;
  1984. X    int newquan;
  1985. X    
  1986. X    if(!pen)
  1987. X        return(0);
  1988. X    if(pen->otyp != MAGIC_MARKER)  {
  1989. X        pline("You can't write with that!");
  1990. X        return(0);
  1991. X    }
  1992. X    
  1993. X    /* get paper to write on */
  1994. X    paper = getobj("?","write on");
  1995. X    if(!paper)
  1996. X        return(0);
  1997. X    if(!(objects[paper->otyp].oc_name_known))  {
  1998. X        pline("In your haste, you rip the scroll to pieces.");
  1999. X        useup(paper);
  2000. X        return(1);
  2001. X    }
  2002. X# ifndef KAA
  2003. X/* If this is included, the strategy would be to name all scrolls so that
  2004. X * you can test them for blankness with a magic marker.  This is tedious,
  2005. X * thus, let's make it easier. */
  2006. X    if(!(objects[paper->otyp].oc_name_known))  {
  2007. X        pline("In your haste, you rip the scroll to pieces.");
  2008. X        useup(paper);
  2009. X        return(0);
  2010. X    }
  2011. X# endif
  2012. X    if(paper->otyp != SCR_BLANK_PAPER)  {
  2013. X        pline("You fool, that scroll's not blank!");
  2014. X        return(0);
  2015. X    }
  2016. X    
  2017. X    /* what to write */
  2018. X    pline("What do you want to write? ");
  2019. X    getlin(namebuf);
  2020. X    if(namebuf[0] == '\033' || !namebuf[0])
  2021. X        return(0);
  2022. X    strcpy(scrbuf,"scroll of ");
  2023. X    strcat(scrbuf,namebuf);
  2024. X    newscroll = readobjnam(scrbuf);
  2025. X    if(newscroll->olet != SCROLL_SYM ||
  2026. X       newscroll->otyp == SCR_BLANK_PAPER)  {
  2027. X        pline("You can't write that!");
  2028. X        pline("It's obscene!");
  2029. X        return(0);
  2030. X    }
  2031. X    
  2032. X    /* see if there's enough ink */
  2033. X    basecost = cost(newscroll);
  2034. X    if(pen->spe < basecost/2)  {
  2035. X        pline("You marker is too dried out to write that!");
  2036. X        obfree(newscroll, (struct obj *) 0);
  2037. X        return(0);
  2038. X    }
  2039. X    
  2040. X    /* we're really going to write now, so calculate
  2041. X     * cost and useup old scroll
  2042. X     */
  2043. X    actualcost = rn1(basecost/2,basecost/2);
  2044. X    useup(paper);
  2045. X    
  2046. X    /* dry out marker */
  2047. X    if(pen->spe < actualcost)  {
  2048. X        pline("Your marker dries out!");
  2049. X        pline("The scroll is now useless and disappears!");
  2050. X        pen->spe = 0;
  2051. X        obfree(newscroll, (struct obj *) 0);
  2052. X        return(1);
  2053. X    }
  2054. X    pen->spe -= actualcost;
  2055. X# ifdef KAA /* Since the KAA modification allows writing on unknown blank
  2056. X        paper, identify blank paper. */
  2057. X    objects[SCR_BLANK_PAPER].oc_name_known=1;
  2058. X# endif
  2059. X    
  2060. X    /* can't write if we don't know it - unless we're lucky */
  2061. X    if(!(objects[newscroll->otyp].oc_name_known) && 
  2062. X# ifdef KAA
  2063. X       !(objects[newscroll->otyp].oc_uname) && 
  2064. X# endif
  2065. X       ((pl_character[0] == 'W' && rn2(3)) ||
  2066. X        (pl_character[0] != 'W' && rn2(10))))  {
  2067. X        pline("You don't know how to write that!");
  2068. X        pline("You write \"Shah was here!\" and the scroll disappears.");
  2069. X        obfree(newscroll, (struct obj *) 0);
  2070. X        return(1);
  2071. X    }
  2072. X    
  2073. X    /* and now you know it! */
  2074. X    objects[newscroll->otyp].oc_name_known = 1;
  2075. X    
  2076. X    /* success - don't forget to fool prinv() */
  2077. X    newscroll = addinv(newscroll);
  2078. X    newquan = newscroll->quan;
  2079. X    newscroll->quan = 1;
  2080. X    prinv(newscroll);
  2081. X    newscroll->quan = newquan;
  2082. X    
  2083. X    return(1);
  2084. X}
  2085. X# endif /* MARKER /**/
  2086. END_OF_write.c
  2087. if test 3864 -ne `wc -c <write.c`; then
  2088.     echo shar: \"write.c\" unpacked with wrong size!
  2089. fi
  2090. # end of overwriting check
  2091. fi
  2092. if test -f you.h -a "${1}" != "-c" ; then 
  2093.   echo shar: Will not over-write existing file \"you.h\"
  2094. else
  2095. echo shar: Extracting \"you.h\" \(3576 characters\)
  2096. sed "s/^X//" >you.h <<'END_OF_you.h'
  2097. X/*    SCCS Id: @(#)you.h    1.3    87/07/14
  2098. X/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  2099. X/* you.h - version 1 */
  2100. X
  2101. X#include "config.h"
  2102. X#include "onames.h"
  2103. X#include "permonst.h"
  2104. X
  2105. Xstruct prop {
  2106. X#define    TIMEOUT        007777    /* mask */
  2107. X#define    LEFT_RING    W_RINGL    /* 010000L */
  2108. X#define    RIGHT_RING    W_RINGR    /* 020000L */
  2109. X#define    INTRINSIC    040000L
  2110. X#define    LEFT_SIDE    LEFT_RING
  2111. X#define    RIGHT_SIDE    RIGHT_RING
  2112. X#define    BOTH_SIDES    (LEFT_SIDE | RIGHT_SIDE)
  2113. X    long p_flgs;
  2114. X    int (*p_tofn)();    /* called after timeout */
  2115. X};
  2116. X
  2117. Xstruct you {
  2118. X    xchar ux, uy;
  2119. X    schar dx, dy, dz;    /* direction of move (or zap or ... ) */
  2120. X    schar di;        /* direction of FF */
  2121. X    xchar ux0, uy0;        /* initial position FF */
  2122. X    xchar udisx, udisy;    /* last display pos */
  2123. X    char usym;        /* usually '@' */
  2124. X    schar uluck;
  2125. X#define    LUCKMAX        10    /* on moonlit nights 11 */
  2126. X#define    LUCKMIN        (-10)
  2127. X    int last_str_turn;    /* 0: none, 1: half turn, 2: full turn */
  2128. X                /* +: turn right, -: turn left */
  2129. X    unsigned udispl;    /* @ on display */
  2130. X    unsigned ulevel;    /* 1 - 14 */
  2131. X#ifdef QUEST
  2132. X    unsigned uhorizon;
  2133. X#endif
  2134. X    unsigned utrap;        /* trap timeout */
  2135. X    unsigned utraptype;    /* defined if utrap nonzero */
  2136. X#define    TT_BEARTRAP    0
  2137. X#define    TT_PIT        1
  2138. X#ifdef SPIDERS
  2139. X#define    TT_WEB        2
  2140. X#endif SPIDERS
  2141. X    unsigned uinshop;    /* used only in shk.c - (roomno+1) of shop */
  2142. X
  2143. X/* perhaps these #define's should also be generated by makedefs */
  2144. X#define    TELEPAT        LAST_RING        /* not a ring */
  2145. X#define    HTelepat    u.uprops[TELEPAT].p_flgs
  2146. X#define    Telepat        ((HTelepat) || (u.usym == 'E'))
  2147. X#define    FAST        (LAST_RING+1)        /* not a ring */
  2148. X#define    Fast        u.uprops[FAST].p_flgs
  2149. X#define    CONFUSION    (LAST_RING+2)        /* not a ring */
  2150. X#define    HConfusion    u.uprops[CONFUSION].p_flgs
  2151. X#define Confusion    ((HConfusion) || index("BIy", u.usym))
  2152. X#define    INVIS        (LAST_RING+3)        /* not a ring */
  2153. X#define    HInvis        u.uprops[INVIS].p_flgs
  2154. X#define Invis        ((HInvis) || u.usym == 'I')
  2155. X#define Invisible    (Invis && !See_invisible)
  2156. X#define    GLIB        (LAST_RING+4)        /* not a ring */
  2157. X#define    Glib        u.uprops[GLIB].p_flgs
  2158. X#define    PUNISHED    (LAST_RING+5)        /* not a ring */
  2159. X#define    Punished    u.uprops[PUNISHED].p_flgs
  2160. X#define    SICK        (LAST_RING+6)        /* not a ring */
  2161. X#define    Sick        u.uprops[SICK].p_flgs
  2162. X#define    BLIND        (LAST_RING+7)        /* not a ring */
  2163. X#define    Blind        u.uprops[BLIND].p_flgs
  2164. X#define    WOUNDED_LEGS    (LAST_RING+8)        /* not a ring */
  2165. X#define Wounded_legs    u.uprops[WOUNDED_LEGS].p_flgs
  2166. X#define STONED        (LAST_RING+9)        /* not a ring */
  2167. X#define Stoned        u.uprops[STONED].p_flgs
  2168. X#define HALLUCINATION    (LAST_RING+10)        /* not a ring */
  2169. X#define Hallucination    u.uprops[HALLUCINATION].p_flgs
  2170. X#define PROP(x) (x-RIN_ADORNMENT)       /* convert ring to index in uprops */
  2171. X    unsigned umconf;
  2172. X    char *usick_cause;
  2173. X    struct prop uprops[LAST_RING+11];
  2174. X    int mh, mhmax, mtimedone, umonnum;        /* for polymorph-self */
  2175. X#if defined(KOPS) && defined(KAA)
  2176. X    unsigned ucreamed;
  2177. X#endif
  2178. X    unsigned uswallow;        /* set if swallowed by a monster */
  2179. X    unsigned uswldtim;        /* time you have been swallowed */
  2180. X    unsigned uhs;            /* hunger state - see hack.eat.c */
  2181. X#ifdef HARD
  2182. X    unsigned udemigod;        /* once you kill the wiz */
  2183. X    unsigned udg_cnt;        /* how long you have been demigod */
  2184. X#endif
  2185. X    schar ustr,ustrmax;
  2186. X    schar udaminc;
  2187. X    schar uac;
  2188. X    int uhp,uhpmax;
  2189. X#ifdef SPELLS
  2190. X    int uen,uenmax;            /* magical energy - M. Stephenson */
  2191. X#endif
  2192. X#ifdef PRAYERS
  2193. X    int ugangr;            /* if the gods are angry at you */
  2194. X    int ublessed,ublesscnt;        /* blessing/duration from #pray */
  2195. X#endif
  2196. X    long int ugold,ugold0,uexp,urexp;
  2197. X    int uhunger;            /* refd only in eat.c and shk.c */
  2198. X    int uinvault;
  2199. X    struct monst *ustuck;
  2200. X    int nr_killed[CMNUM+2];        /* used for experience bookkeeping */
  2201. X};
  2202. END_OF_you.h
  2203. if test 3576 -ne `wc -c <you.h`; then
  2204.     echo shar: \"you.h\" unpacked with wrong size!
  2205. fi
  2206. # end of overwriting check
  2207. fi
  2208. echo shar: End of archive 15 \(of 16\).
  2209. cp /dev/null ark15isdone
  2210. MISSING=""
  2211. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ; do
  2212.     if test ! -f ark${I}isdone ; then
  2213.     MISSING="${MISSING} ${I}"
  2214.     fi
  2215. done
  2216. if test "${MISSING}" = "" ; then
  2217.     echo You have unpacked all 16 archives.
  2218.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2219. else
  2220.     echo You still need to unpack the following archives:
  2221.     echo "        " ${MISSING}
  2222. fi
  2223. ##  End of shell archive.
  2224. exit 0
  2225.